package cn.lhq.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {

	public static Session getSession(){
		String cfg = "hibernate.cfg.xml";
		
		Configuration conf = 
				new Configuration();
		conf.configure(cfg);
		SessionFactory sf = 
			conf.buildSessionFactory();
		
		Session session = 
				sf.openSession();
		return session;
	}
	
	public static void main(String[] args){
		Session session = 
			HibernateUtil.getSession();
		System.out.println(session);
	}
	
}
